package org.example.salary.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

/**
 * @author : yurui
 * @date : 2024/6/2
 * @TIME : 12:43
 * @project : AuthDemo
 */

@Configuration
public class MyWebSecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        System.out.println("运行了MyWebSecurityConfig-configure(HttpSecurity http)1111111111111");
        http.csrf().disable()
                //对请求进行验证
                .authorizeRequests()
                //设置访问权限
                .antMatchers("/salary/**")
                .hasAuthority("salary")
                //对其他的请求都不拦截
                .anyRequest().permitAll();
    }
}
